package com.party.core.model.system;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 字典类型枚举
 * Created by yifeng
 *
 * @date 2018/3/19 0019
 * @time 上午 10:20
 */
public enum DictEnum {
    ACTIVITY_TYPE("activity_type", "活动类型"),

    CHECK_STATUS("check_status", "审核状态"),

    AD_TYPE("ad_type", "广告位置"),

    AD_TAG("ad_tag", "内部广告类型"),

    ARTICLE_TYPE("article_type", "文章类型"),

    CIRCLE_TYPE("circle_type", "圈子类型"),

    ORDER_TYPE("OrderType", "订单类型"),

    RESOURCE_TYPE("resource_type", "资源类型"),
    MATERIAL_TYPE("material_type", "资源类型");
    //状态码
    private String code;

    //状态值
    private String value;

    DictEnum(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (DictEnum roleType : DictEnum.values()) {
            if (roleType.getCode().equals(code)) {
                return roleType.getValue();
            }
        }
        return null;
    }

    public static Map<String, String> convertMap() {
        Map<String, String> map = Maps.newHashMap();
        for (DictEnum roleType : DictEnum.values()) {
            map.put(roleType.getCode(), roleType.getValue());
        }
        return map;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
